<?php
class Cabang_model extends Model {

var $table = 'cabang';
	/**
	 * Constructor
	 */
	function Cabang_model()
	{
		parent::Model();
	}
	
function count_all(){
	return $this->db->count_all($this->cabang);
	}
    function get_paged_list($limit = 10, $offset = 0){
        $this->db->order_by('id','asc');
        return $this->db->get($this->cabang, $limit, $offset);
    }	
	
	function get_cabang_by_id($id){
        $this->db->where('id', $id);
        return $this->db->get($this->cabang);
    }
	
	 function save($cabang){
        $this->db->insert($this->cabang, $cabang);
        return $this->db->insert_id();
    }
	
	function update($id, $cabang){
        $this->db->where('id', $id);
        $this->db->update($this->cabang, $cabang);
    }
	
	function delete($id){
        $this->db->where('id', $id);
        $this->db->delete($this->cabang);
    }
	function get_cabang()
	{
		$this->db->order_by('id_cabang');
		return $this->db->get('cabang');
	}
	
	}
	?>